<?php
include'../Classes/db.php'; 
include'../Classes/attstudentHandler.php';

$x=new DbConnect();
$con=$x->getConnection();

$regno=$_GET['regno'];
$date1=$_GET['att_dt'];
$subgr=$_GET['subgr'];

$month=substr($date1,3,2);
$year=substr($date1,6,4);
$date=substr($date1,0,2);
$day=$year."-".$month."-".$date;//arrange date in format

$att=new AttStudentHandler();//craete new object
$att->setRegno($regno);
$att->setSubgr($subgr);
$att->setDay($day);
$att->setMonth($month);
$att->setConnect($con);

$time_now=mktime(date('H')+5,date('i')+30,date('s'),date('m'),date('d'),date('Y'));
	 $yearnw=date('Y',$time_now); 
 	 $monthnw=date('m',$time_now); 
 	 $datenw=date('d',$time_now);



	if (($year < $yearnw) || (($year == $yearnw)&&($month < $monthnw)) || (($year == $yearnw)&&($month = $monthnw)&&($date <= $datenw)))
			{
			$result=$att->attAdd();
			echo $result;
			}
	else 
			{
			echo "Future Date !";
			}

?>